package direct;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import utils.RabbitMQUtils;

/**
 * @author lucine
 * @version 1.0 2021/6/20 11:37
 */
public class Provider {

    public static void main(String[] args) throws Exception {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        //通过通道声明交换机 参数1交换机名称 参数2 交换机类型
        channel.exchangeDeclare("testDirect","direct");
        String routingKey = "info";
        //发送消息
        channel.basicPublish("testDirect",routingKey,null,("这是direct模型发布基于 routingKey ：["+routingKey+"]").getBytes());

        RabbitMQUtils.cloneConnectionAndChannel(channel,connection);


    }
}
